package com.shh.rabbitmq.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import com.shh.rabbitmq.domain.OrderDO;


@Repository
public class OrderDao {
	
	  @Autowired
	  private JdbcTemplate jdbcTemplate;
	  
	  private String addSql = "insert into order_ditribute(orderno,orderdesc) values ('%s','%s')";
	  private String upSql = "update order_ditribute set orderdesc='%s' where orderno=%s";
	  

	  
	  public void addOrder(OrderDO order) {
	    String sql = String.format(addSql, order.getOrderNo(), order.getOrderDesc());
	    jdbcTemplate.execute(sql);
	  }
	  
	  public void updateModel(OrderDO order) {
	    String sql = String.format(upSql, order.getOrderDesc(), order.getOrderNo());
	    jdbcTemplate.execute(sql);
	  }
	  

}
